package com.jinwei.qunguanjia.system.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.jinwei.qunguanjia.system.dao.SysUserDAO;
import com.jinwei.qunguanjia.system.dao.SysUserRoleDAO;
import com.jinwei.qunguanjia.system.dto.SysInitDTO;
import com.jinwei.qunguanjia.system.dto.SysUserDTO;
import com.jinwei.qunguanjia.system.po.SysUserPO;
import com.jinwei.qunguanjia.system.po.SysUserRolePO;
import com.jinwei.qunguanjia.system.utils.SecurityUtils;
import com.jinwei.qunguanjia.common.constant.UserConstants;
import com.jinwei.qunguanjia.common.core.domain.model.Condition;
import com.jinwei.qunguanjia.common.core.page.PageDataInfo;
import com.jinwei.qunguanjia.common.exception.GlobalExceptionHelper;
import com.jinwei.qunguanjia.common.utils.*;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 系统用户 服务层实现类
 * @author yuanzs
 */
@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService {

    @Resource
    private SysUserDAO sysUserDAO;

    @Resource
    private SysUserRoleDAO sysUserRoleDAO;

    @Override
    public void save(SysUserDTO sysUserDTO) {
        SysUserPO sysUserPO = new SysUserPO();
        BeanUtils.copyProperties(sysUserDTO, sysUserPO);
        sysUserPO.setUserId(IdUtils.getWorkerId());
        sysUserDAO.insert(sysUserPO);
    }

    @Override
    public void remove(String id) {

    }

    @Override
    public void update(SysUserDTO sysUserDTO) {
        SysUserPO sysUserPO = new SysUserPO();
        BeanUtils.copyProperties(sysUserDTO, sysUserPO);
        sysUserDAO.updateById(sysUserPO);
    }

    @Override
    public SysUserDTO get(String id) {
        return null;
    }

    @Override
    public SysUserDTO get(SysUserDTO sysUserDTO) throws IllegalAccessException {
        // 添加查询条件
        List<Condition> conditionList = ConditionUtils.add(sysUserDTO);
        // 拼接查询条件
        QueryWrapper<SysUserPO> queryWrapper = SearchUtils.parseWhereSql(conditionList);
        SysUserPO sysUserPO = sysUserDAO.selectOne(queryWrapper);
        if (null == sysUserPO){
            return null;
        }
        BeanUtils.copyProperties(sysUserPO, sysUserDTO);
        return sysUserDTO;
    }

    @Override
    public Long count(SysUserDTO sysUserDTO) throws IllegalAccessException {
        // 添加查询条件
        List<Condition> conditionList = ConditionUtils.add(sysUserDTO);
        // 拼接查询条件
        QueryWrapper<SysUserPO> queryWrapper = SearchUtils.parseWhereSql(conditionList);
        return sysUserDAO.selectCount(queryWrapper);
    }

    @Override
    public List<SysUserDTO> list(SysUserDTO sysUserDTO) throws IllegalAccessException {
        // 添加查询条件
        List<Condition> conditionList = ConditionUtils.add(sysUserDTO);
        // 拼接查询条件
        QueryWrapper<SysUserPO> queryWrapper = SearchUtils.parseWhereSql(conditionList);
        return JsonUtils.copyList(sysUserDAO.selectList(queryWrapper), SysUserDTO.class);
    }

    @Override
    public PageDataInfo<SysUserDTO> listPage(SysUserDTO sysUserDTO) {
        List<SysUserDTO> list = sysUserDAO.listUser(sysUserDTO);
        PageInfo<SysUserDTO> pageInfo = new PageInfo<>(list);
        PageDataInfo<SysUserDTO> pageDataInfo = new PageDataInfo<>();
        pageDataInfo.setData(list);
        pageDataInfo.setTotal(pageInfo.getTotal());
        return pageDataInfo;
    }

    @Override
    public PageDataInfo<SysUserDTO> listAllocated(SysUserDTO sysUserDTO) {
        List<SysUserDTO> list = sysUserDAO.listAllocated(sysUserDTO);
        PageInfo<SysUserDTO> pageInfo = new PageInfo<>(list);
        PageDataInfo<SysUserDTO> pageDataInfo = new PageDataInfo<>();
        pageDataInfo.setData(list);
        pageDataInfo.setTotal(pageInfo.getTotal());
        return pageDataInfo;
    }

    @Override
    public PageDataInfo<SysUserDTO> listUnallocated(SysUserDTO sysUserDTO) {
        List<SysUserDTO> list = sysUserDAO.listUnallocated(sysUserDTO);
        PageInfo<SysUserDTO> pageInfo = new PageInfo<>(list);
        PageDataInfo<SysUserDTO> pageDataInfo = new PageDataInfo<>();
        pageDataInfo.setData(list);
        pageDataInfo.setTotal(pageInfo.getTotal());
        return pageDataInfo;
    }

    @Override
    public SysUserDTO getUserByUserName(String userName) {
        return sysUserDAO.getUserByUserName(userName);
    }

    @Override
    public SysUserDTO getUserById(String id) {
        return sysUserDAO.getUserById(id);
    }

    @Override
    public String checkUserNameUnique(String userName) throws IllegalAccessException {
        int count = list(SysUserDTO.builder().userName(userName).build()).size();
        if (count > 0) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    @Override
    public String checkPhoneUnique(SysUserDTO sysUserDTO) throws IllegalAccessException {
        String userId = StringUtils.isNull(sysUserDTO.getUserId()) ? "-1" : sysUserDTO.getUserId();
        SysUserDTO info = get(SysUserDTO.builder().phoneNumber(sysUserDTO.getPhoneNumber()).build());
        if (StringUtils.isNotNull(info) && !info.getUserId().equals(userId)) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    @Override
    public String checkEmailUnique(SysUserDTO sysUserDTO) throws IllegalAccessException {
        String userId = StringUtils.isNull(sysUserDTO.getUserId()) ? "-1" : sysUserDTO.getUserId();
        SysUserDTO info = get(SysUserDTO.builder().email(sysUserDTO.getEmail()).build());
        if (StringUtils.isNotNull(info) && !info.getUserId().equals(userId)) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    @Override
    public void checkUserAllowed(String userId) {
        if (StringUtils.isNotNull(userId) && SecurityUtils.isAdmin(userId)) {
            throw GlobalExceptionHelper.localServiceException("不允许操作超级管理员用户！");
        }
    }

    @Override
    public void checkUserDataScope(String userId) {
        if (!SecurityUtils.isAdmin(userId)) {
            SysUserDTO sysUserDTO = new SysUserDTO();
            sysUserDTO.setUserId(userId);
            List<SysUserDTO> users = listPage(sysUserDTO).getData();
            if (StringUtils.isEmpty(users)) {
                throw GlobalExceptionHelper.localServiceException("没有权限访问用户数据！");
            }
        }
    }

    @Override
    @Transactional
    public void saveUserAuth(String userId, String[] roleIds) {
        LambdaQueryWrapper<SysUserRolePO> lambdaWrapper = new LambdaQueryWrapper<>();
        lambdaWrapper.eq(SysUserRolePO::getUserId, userId);
        sysUserRoleDAO.delete(lambdaWrapper);
        if (StringUtils.isNotEmpty(roleIds)) {
            // 新增用户与角色管理
            List<SysUserRolePO> list = new ArrayList<>(roleIds.length);
            for (String roleId : roleIds) {
                SysUserRolePO sysUserRolePO = new SysUserRolePO();
                sysUserRolePO.setUserId(userId);
                sysUserRolePO.setRoleId(roleId);
                list.add(sysUserRolePO);
            }
            sysUserRoleDAO.saveBatch(list);
        }
    }

    @Override
    public void init(SysInitDTO sysInitDTO) {
        sysInitDTO.setAdminAccountId(IdUtils.getWorkerId());
        sysInitDTO.setAdminRoleId(IdUtils.getWorkerId());
        sysInitDTO.setAdminDeptId(IdUtils.getWorkerId());
        sysInitDTO.setConfigList(initConfig());
        sysInitDTO.setDictTypeList(initDictType());
        sysInitDTO.setDictDataList(initDictData());
        sysInitDTO.setCreateTime(DateUtils.getDateTime());
        sysUserDAO.init(sysInitDTO);
    }

    private List<Map<String, Object>> initConfig(){
        List<Map<String, Object>> configList = new ArrayList<>();
        Map<String, Object> skinNameMap = new HashMap<>();
        skinNameMap.put("configId", IdUtils.getWorkerId());
        skinNameMap.put("configName", "主框架页-默认皮肤样式名称");
        skinNameMap.put("configKey", "sys.index.skinName");
        skinNameMap.put("configValue", "skin-blue");
        skinNameMap.put("remark", "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow");
        configList.add(skinNameMap);
        Map<String, Object> initPasswordMap = new HashMap<>();
        initPasswordMap.put("configId", IdUtils.getWorkerId());
        initPasswordMap.put("configName", "用户管理-账号初始密码");
        initPasswordMap.put("configKey", "sys.user.initPassword");
        initPasswordMap.put("configValue", "123456");
        initPasswordMap.put("remark", "初始化密码 123456");
        configList.add(initPasswordMap);
        Map<String, Object> sideThemeMap = new HashMap<>();
        sideThemeMap.put("configId", IdUtils.getWorkerId());
        sideThemeMap.put("configName", "主框架页-侧边栏主题");
        sideThemeMap.put("configKey", "sys.index.sideTheme");
        sideThemeMap.put("configValue", "theme-dark");
        sideThemeMap.put("remark", "深色主题theme-dark，浅色主题theme-light");
        configList.add(sideThemeMap);
        Map<String, Object> captchaEnabledMap = new HashMap<>();
        captchaEnabledMap.put("configId", IdUtils.getWorkerId());
        captchaEnabledMap.put("configName", "账号自助-验证码开关");
        captchaEnabledMap.put("configKey", "sys.account.captchaEnabled");
        captchaEnabledMap.put("configValue", "true");
        captchaEnabledMap.put("remark", "是否开启验证码功能（true开启，false关闭）");
        configList.add(captchaEnabledMap);
        return configList;
    }

    private List<Map<String, Object>> initDictType(){
        List<Map<String, Object>> dictTypeList = new ArrayList<>();
        Map<String, Object> sysUserSexMap = new HashMap<>();
        sysUserSexMap.put("dictTypeId", IdUtils.getWorkerId());
        sysUserSexMap.put("dictName", "用户性别");
        sysUserSexMap.put("dictType", "sys_user_sex");
        sysUserSexMap.put("remark", "用户性别列表");
        dictTypeList.add(sysUserSexMap);
        Map<String, Object> sysShowHideMap = new HashMap<>();
        sysShowHideMap.put("dictTypeId", IdUtils.getWorkerId());
        sysShowHideMap.put("dictName", "菜单状态");
        sysShowHideMap.put("dictType", "sys_show_hide");
        sysShowHideMap.put("remark", "菜单状态列表");
        dictTypeList.add(sysShowHideMap);
        Map<String, Object> sysNormalDisableMap = new HashMap<>();
        sysNormalDisableMap.put("dictTypeId", IdUtils.getWorkerId());
        sysNormalDisableMap.put("dictName", "系统开关");
        sysNormalDisableMap.put("dictType", "sys_normal_disable");
        sysNormalDisableMap.put("remark", "系统开关列表");
        dictTypeList.add(sysNormalDisableMap);
        Map<String, Object> sysYesNoMap = new HashMap<>();
        sysYesNoMap.put("dictTypeId", IdUtils.getWorkerId());
        sysYesNoMap.put("dictName", "系统是否");
        sysYesNoMap.put("dictType", "sys_yes_no");
        sysYesNoMap.put("remark", "系统是否列表");
        dictTypeList.add(sysYesNoMap);
        Map<String, Object> sysNoticeTypeMap = new HashMap<>();
        sysNoticeTypeMap.put("dictTypeId", IdUtils.getWorkerId());
        sysNoticeTypeMap.put("dictName", "通知类型");
        sysNoticeTypeMap.put("dictType", "sys_notice_type");
        sysNoticeTypeMap.put("remark", "通知类型列表");
        dictTypeList.add(sysNoticeTypeMap);
        Map<String, Object> sysNoticeStatusMap = new HashMap<>();
        sysNoticeStatusMap.put("dictTypeId", IdUtils.getWorkerId());
        sysNoticeStatusMap.put("dictName", "通知状态");
        sysNoticeStatusMap.put("dictType", "sys_notice_status");
        sysNoticeStatusMap.put("remark", "通知状态列表");
        dictTypeList.add(sysNoticeStatusMap);
        Map<String, Object> sysOperTypeMap = new HashMap<>();
        sysOperTypeMap.put("dictTypeId", IdUtils.getWorkerId());
        sysOperTypeMap.put("dictName", "操作类型");
        sysOperTypeMap.put("dictType", "sys_oper_type");
        sysOperTypeMap.put("remark", "操作类型列表");
        dictTypeList.add(sysOperTypeMap);
        Map<String, Object> sysCommonStatusMap = new HashMap<>();
        sysCommonStatusMap.put("dictTypeId", IdUtils.getWorkerId());
        sysCommonStatusMap.put("dictName", "系统状态");
        sysCommonStatusMap.put("dictType", "sys_common_status");
        sysCommonStatusMap.put("remark", "登录状态列表");
        dictTypeList.add(sysCommonStatusMap);
        return dictTypeList;
    }

    private List<Map<String, Object>> initDictData(){
        List<Map<String, Object>> dictDataList = new ArrayList<>();
        Map<String, Object>  sysUserSexDictDataMap1 = new HashMap<>();
        sysUserSexDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysUserSexDictDataMap1.put("dictSort", "1");
        sysUserSexDictDataMap1.put("dictLabel", "男");
        sysUserSexDictDataMap1.put("dictValue", "0");
        sysUserSexDictDataMap1.put("dictType", "sys_user_sex");
        sysUserSexDictDataMap1.put("listClass", "");
        sysUserSexDictDataMap1.put("isDefault", "Y");
        sysUserSexDictDataMap1.put("remark", "性别男");
        dictDataList.add(sysUserSexDictDataMap1);
        Map<String, Object>  sysUserSexDictDataMap2 = new HashMap<>();
        sysUserSexDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysUserSexDictDataMap2.put("dictSort", "2");
        sysUserSexDictDataMap2.put("dictLabel", "女");
        sysUserSexDictDataMap2.put("dictValue", "1");
        sysUserSexDictDataMap2.put("dictType", "sys_user_sex");
        sysUserSexDictDataMap2.put("listClass", "");
        sysUserSexDictDataMap2.put("isDefault", "N");
        sysUserSexDictDataMap2.put("remark", "性别女");
        dictDataList.add(sysUserSexDictDataMap2);
        Map<String, Object>  sysUserSexDictDataMap3 = new HashMap<>();
        sysUserSexDictDataMap3.put("dictDataId", IdUtils.getWorkerId());
        sysUserSexDictDataMap3.put("dictSort", "3");
        sysUserSexDictDataMap3.put("dictLabel", "未知");
        sysUserSexDictDataMap3.put("dictValue", "2");
        sysUserSexDictDataMap3.put("dictType", "sys_user_sex");
        sysUserSexDictDataMap3.put("listClass", "");
        sysUserSexDictDataMap3.put("isDefault", "N");
        sysUserSexDictDataMap3.put("remark", "性别未知");
        dictDataList.add(sysUserSexDictDataMap3);
        Map<String, Object>  sysShowHideDictDataMap1 = new HashMap<>();
        sysShowHideDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysShowHideDictDataMap1.put("dictSort", "1");
        sysShowHideDictDataMap1.put("dictLabel", "显示");
        sysShowHideDictDataMap1.put("dictValue", "0");
        sysShowHideDictDataMap1.put("dictType", "sys_show_hide");
        sysShowHideDictDataMap1.put("listClass", "primary");
        sysShowHideDictDataMap1.put("isDefault", "Y");
        sysShowHideDictDataMap1.put("remark", "显示菜单");
        dictDataList.add(sysShowHideDictDataMap1);
        Map<String, Object>  sysShowHideDictDataMap2 = new HashMap<>();
        sysShowHideDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysShowHideDictDataMap2.put("dictSort", "2");
        sysShowHideDictDataMap2.put("dictLabel", "隐藏");
        sysShowHideDictDataMap2.put("dictValue", "1");
        sysShowHideDictDataMap2.put("dictType", "sys_show_hide");
        sysShowHideDictDataMap2.put("listClass", "danger");
        sysShowHideDictDataMap2.put("isDefault", "N");
        sysShowHideDictDataMap2.put("remark", "隐藏菜单");
        dictDataList.add(sysShowHideDictDataMap2);
        Map<String, Object>  sysNormalDisableDictDataMap1 = new HashMap<>();
        sysNormalDisableDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysNormalDisableDictDataMap1.put("dictSort", "1");
        sysNormalDisableDictDataMap1.put("dictLabel", "正常");
        sysNormalDisableDictDataMap1.put("dictValue", "0");
        sysNormalDisableDictDataMap1.put("dictType", "sys_normal_disable");
        sysNormalDisableDictDataMap1.put("listClass", "primary");
        sysNormalDisableDictDataMap1.put("isDefault", "Y");
        sysNormalDisableDictDataMap1.put("remark", "正常状态");
        dictDataList.add(sysNormalDisableDictDataMap1);
        Map<String, Object>  sysNormalDisableDictDataMap2 = new HashMap<>();
        sysNormalDisableDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysNormalDisableDictDataMap2.put("dictSort", "2");
        sysNormalDisableDictDataMap2.put("dictLabel", "停用");
        sysNormalDisableDictDataMap2.put("dictValue", "1");
        sysNormalDisableDictDataMap2.put("dictType", "sys_normal_disable");
        sysNormalDisableDictDataMap2.put("listClass", "danger");
        sysNormalDisableDictDataMap2.put("isDefault", "N");
        sysNormalDisableDictDataMap2.put("remark", "停用状态");
        dictDataList.add(sysNormalDisableDictDataMap2);
        Map<String, Object>  sysYesNoDictDataMap1 = new HashMap<>();
        sysYesNoDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysYesNoDictDataMap1.put("dictSort", "1");
        sysYesNoDictDataMap1.put("dictLabel", "是");
        sysYesNoDictDataMap1.put("dictValue", "Y");
        sysYesNoDictDataMap1.put("dictType", "sys_yes_no");
        sysYesNoDictDataMap1.put("listClass", "primary");
        sysYesNoDictDataMap1.put("isDefault", "Y");
        sysYesNoDictDataMap1.put("remark", "系统默认是");
        dictDataList.add(sysYesNoDictDataMap1);
        Map<String, Object>  sysYesNoDictDataMap2 = new HashMap<>();
        sysYesNoDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysYesNoDictDataMap2.put("dictSort", "2");
        sysYesNoDictDataMap2.put("dictLabel", "否");
        sysYesNoDictDataMap2.put("dictValue", "N");
        sysYesNoDictDataMap2.put("dictType", "sys_yes_no");
        sysYesNoDictDataMap2.put("listClass", "danger");
        sysYesNoDictDataMap2.put("isDefault", "N");
        sysYesNoDictDataMap2.put("remark", "系统默认否");
        dictDataList.add(sysYesNoDictDataMap2);
        Map<String, Object>  sysNoticeTypeDictDataMap1 = new HashMap<>();
        sysNoticeTypeDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysNoticeTypeDictDataMap1.put("dictSort", "1");
        sysNoticeTypeDictDataMap1.put("dictLabel", "通知");
        sysNoticeTypeDictDataMap1.put("dictValue", "1");
        sysNoticeTypeDictDataMap1.put("dictType", "sys_notice_type");
        sysNoticeTypeDictDataMap1.put("listClass", "warning");
        sysNoticeTypeDictDataMap1.put("isDefault", "Y");
        sysNoticeTypeDictDataMap1.put("remark", "通知");
        dictDataList.add(sysNoticeTypeDictDataMap1);
        Map<String, Object>  sysNoticeTypeDictDataMap2 = new HashMap<>();
        sysNoticeTypeDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysNoticeTypeDictDataMap2.put("dictSort", "2");
        sysNoticeTypeDictDataMap2.put("dictLabel", "公告");
        sysNoticeTypeDictDataMap2.put("dictValue", "2");
        sysNoticeTypeDictDataMap2.put("dictType", "sys_notice_type");
        sysNoticeTypeDictDataMap2.put("listClass", "success");
        sysNoticeTypeDictDataMap2.put("isDefault", "N");
        sysNoticeTypeDictDataMap2.put("remark", "公告");
        dictDataList.add(sysNoticeTypeDictDataMap2);
        Map<String, Object>  sysNoticeStatusDictDataMap1 = new HashMap<>();
        sysNoticeStatusDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysNoticeStatusDictDataMap1.put("dictSort", "1");
        sysNoticeStatusDictDataMap1.put("dictLabel", "正常");
        sysNoticeStatusDictDataMap1.put("dictValue", "0");
        sysNoticeStatusDictDataMap1.put("dictType", "sys_notice_status");
        sysNoticeStatusDictDataMap1.put("listClass", "primary");
        sysNoticeStatusDictDataMap1.put("isDefault", "Y");
        sysNoticeStatusDictDataMap1.put("remark", "正常状态");
        dictDataList.add(sysNoticeStatusDictDataMap1);
        Map<String, Object>  sysNoticeStatusDictDataMap2 = new HashMap<>();
        sysNoticeStatusDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysNoticeStatusDictDataMap2.put("dictSort", "2");
        sysNoticeStatusDictDataMap2.put("dictLabel", "关闭");
        sysNoticeStatusDictDataMap2.put("dictValue", "1");
        sysNoticeStatusDictDataMap2.put("dictType", "sys_notice_status");
        sysNoticeStatusDictDataMap2.put("listClass", "danger");
        sysNoticeStatusDictDataMap2.put("isDefault", "N");
        sysNoticeStatusDictDataMap2.put("remark", "关闭状态");
        dictDataList.add(sysNoticeStatusDictDataMap2);
        Map<String, Object>  sysOperTypeDictDataMap1 = new HashMap<>();
        sysOperTypeDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap1.put("dictSort", "1");
        sysOperTypeDictDataMap1.put("dictLabel", "新增");
        sysOperTypeDictDataMap1.put("dictValue", "1");
        sysOperTypeDictDataMap1.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap1.put("listClass", "info");
        sysOperTypeDictDataMap1.put("isDefault", "N");
        sysOperTypeDictDataMap1.put("remark", "新增操作");
        dictDataList.add(sysOperTypeDictDataMap1);
        Map<String, Object>  sysOperTypeDictDataMap2 = new HashMap<>();
        sysOperTypeDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap2.put("dictSort", "2");
        sysOperTypeDictDataMap2.put("dictLabel", "修改");
        sysOperTypeDictDataMap2.put("dictValue", "2");
        sysOperTypeDictDataMap2.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap2.put("listClass", "info");
        sysOperTypeDictDataMap2.put("isDefault", "N");
        sysOperTypeDictDataMap2.put("remark", "修改操作");
        dictDataList.add(sysOperTypeDictDataMap2);
        Map<String, Object>  sysOperTypeDictDataMap3 = new HashMap<>();
        sysOperTypeDictDataMap3.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap3.put("dictSort", "3");
        sysOperTypeDictDataMap3.put("dictLabel", "删除");
        sysOperTypeDictDataMap3.put("dictValue", "3");
        sysOperTypeDictDataMap3.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap3.put("listClass", "danger");
        sysOperTypeDictDataMap3.put("isDefault", "N");
        sysOperTypeDictDataMap3.put("remark", "删除操作");
        dictDataList.add(sysOperTypeDictDataMap3);
        Map<String, Object>  sysOperTypeDictDataMap4 = new HashMap<>();
        sysOperTypeDictDataMap4.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap4.put("dictSort", "4");
        sysOperTypeDictDataMap4.put("dictLabel", "授权");
        sysOperTypeDictDataMap4.put("dictValue", "4");
        sysOperTypeDictDataMap4.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap4.put("listClass", "primary");
        sysOperTypeDictDataMap4.put("isDefault", "N");
        sysOperTypeDictDataMap4.put("remark", "授权操作");
        dictDataList.add(sysOperTypeDictDataMap4);
        Map<String, Object>  sysOperTypeDictDataMap5 = new HashMap<>();
        sysOperTypeDictDataMap5.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap5.put("dictSort", "5");
        sysOperTypeDictDataMap5.put("dictLabel", "导出");
        sysOperTypeDictDataMap5.put("dictValue", "5");
        sysOperTypeDictDataMap5.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap5.put("listClass", "warning");
        sysOperTypeDictDataMap5.put("isDefault", "N");
        sysOperTypeDictDataMap5.put("remark", "导出操作");
        dictDataList.add(sysOperTypeDictDataMap5);
        Map<String, Object>  sysOperTypeDictDataMap6 = new HashMap<>();
        sysOperTypeDictDataMap6.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap6.put("dictSort", "6");
        sysOperTypeDictDataMap6.put("dictLabel", "导入");
        sysOperTypeDictDataMap6.put("dictValue", "6");
        sysOperTypeDictDataMap6.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap6.put("listClass", "warning");
        sysOperTypeDictDataMap6.put("isDefault", "N");
        sysOperTypeDictDataMap6.put("remark", "导入操作");
        dictDataList.add(sysOperTypeDictDataMap6);
        Map<String, Object>  sysOperTypeDictDataMap7 = new HashMap<>();
        sysOperTypeDictDataMap7.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap7.put("dictSort", "7");
        sysOperTypeDictDataMap7.put("dictLabel", "强退");
        sysOperTypeDictDataMap7.put("dictValue", "7");
        sysOperTypeDictDataMap7.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap7.put("listClass", "danger");
        sysOperTypeDictDataMap7.put("isDefault", "N");
        sysOperTypeDictDataMap7.put("remark", "强退操作");
        dictDataList.add(sysOperTypeDictDataMap7);
        Map<String, Object>  sysOperTypeDictDataMap8 = new HashMap<>();
        sysOperTypeDictDataMap8.put("dictDataId", IdUtils.getWorkerId());
        sysOperTypeDictDataMap8.put("dictSort", "8");
        sysOperTypeDictDataMap8.put("dictLabel", "刷新缓存");
        sysOperTypeDictDataMap8.put("dictValue", "8");
        sysOperTypeDictDataMap8.put("dictType", "sys_oper_type");
        sysOperTypeDictDataMap8.put("listClass", "danger");
        sysOperTypeDictDataMap8.put("isDefault", "N");
        sysOperTypeDictDataMap8.put("remark", "刷新缓存");
        dictDataList.add(sysOperTypeDictDataMap8);
        Map<String, Object>  sysCommonStatusDictDataMap1 = new HashMap<>();
        sysCommonStatusDictDataMap1.put("dictDataId", IdUtils.getWorkerId());
        sysCommonStatusDictDataMap1.put("dictSort", "1");
        sysCommonStatusDictDataMap1.put("dictLabel", "成功");
        sysCommonStatusDictDataMap1.put("dictValue", "0");
        sysCommonStatusDictDataMap1.put("dictType", "sys_common_status");
        sysCommonStatusDictDataMap1.put("listClass", "primary");
        sysCommonStatusDictDataMap1.put("isDefault", "N");
        sysCommonStatusDictDataMap1.put("remark", "成功");
        dictDataList.add(sysCommonStatusDictDataMap1);
        Map<String, Object>  sysCommonStatusDictDataMap2 = new HashMap<>();
        sysCommonStatusDictDataMap2.put("dictDataId", IdUtils.getWorkerId());
        sysCommonStatusDictDataMap2.put("dictSort", "2");
        sysCommonStatusDictDataMap2.put("dictLabel", "失败");
        sysCommonStatusDictDataMap2.put("dictValue", "1");
        sysCommonStatusDictDataMap2.put("dictType", "sys_common_status");
        sysCommonStatusDictDataMap2.put("listClass", "danger");
        sysCommonStatusDictDataMap2.put("isDefault", "N");
        sysCommonStatusDictDataMap2.put("remark", "失败");
        dictDataList.add(sysCommonStatusDictDataMap2);
        return dictDataList;
    }
}
